<?php
namespace Swiftx\Bundle\WeChat\Model\Client;
use Swiftx\Bundle\WeChat\Interfaces\Common\BaseModel;
use Swiftx\Bundle\WeChat\Model\Seller\Company;

/**
 * 商品模型类
 */
class AppLie extends BaseModel {

    /**
     * 小程序编号
     * @var string
     * @orm constraint primary
     * @orm constraint no-null
     * @orm type char(36)
     * @orm column ID
     */
    protected $id;

    /**
     * 所属企业
     * @var int
     * @orm constraint no-null
     * @orm type char(36)
     * @orm column Company
     */
    protected $company;

    /**
     * 服务端秘钥
     * @var string
     * @orm constraint no-null
     * @orm type varchar(100)
     * @orm column Secret
     */
    protected $secret;

    /**
     * 设置主键
     * @param string $value
     */
    public function setID(string $value){
        $this->id = $value;
    }

    /**
     * 读取主键
     * @return string
     */
    public function getID():string {
        return $this->id;
    }

    /**
     * 设置所属企业
     * @param string $company
     */
    public function setCompanyID(string $company){
        $this->company = $company;
    }

    /**
     * 读取企业ID
     * @return string
     */
    public function getCompanyID():string {
        return $this->company;
    }

    /**
     * 获取相关企业
     * @return Company
     */
    public function getCompany():Company{
        /** @var Company $result */
        $result = $this->entityManager->fetch(Company::class,$this->getCompanyID());
        return $result;
    }

    /**
     * 设置秘钥
     * @param string $value
     */
    public function setSecret(string $value){
        $this->secret = $value;
    }

    /**
     * 读取秘钥
     * @return string
     */
    public function getSecret():string {
        return $this->secret;
    }

}